
package sismed.gui.comando;

import sismed.exception.DAOException;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import sismed.negocio.fachada.Fachada;
import sismed.negocio.modelo.Exame;

public class ComandoListarExamesHematologicos extends ComandoGenerico{

	@Override
	public void executar(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		if(request.getSession().getAttribute("tipoUsuario").equals(null))				
			response.sendRedirect("login.jsp");
		else{
			Fachada fachada = Fachada.getInstance();
			List<Exame> lista=null;
			try {
				lista = fachada.recuperarExamesPorTipo( "examehematologico" );
			} catch (DAOException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			request.setAttribute("ListaExame", lista);
			request.setAttribute("teste", "ok");
			try  {			
				request.getRequestDispatcher("listaHematologia.jsp").forward(request, response);	
			} 
			catch ( Exception e )  {
				request.getRequestDispatcher("erro.jsp").forward(request, response);	
			}
		}
	}

}
